__author__ = 'Paul'
from five import grok
from zope.lifecycleevent.interfaces import IObjectAddedEvent
from Products.CMFCore.utils import getToolByName
from Products.ATContentTypes.interface import IATFolder

@grok.subscribe(IATFolder, IObjectAddedEvent)
def defaultView(carpeta, event):
    """Setea la vista por defecto de una carpeta"""

    if carpeta.portal_type!= "Product.bpContents.directorio":
        if carpeta.getLayout()!="listadoDirectorio":
            carpeta.setLayout("listadoDirectorio")